﻿using MediatR;
using SheepStorage.API.Application.Command.SheepRecordCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class ShowBreedStateCommandHandler : IRequestHandler<ShowBreedStateCommand, Results<List<SheepRecord>>>
    {
        ISheepRecordService _res;

        public ShowBreedStateCommandHandler(ISheepRecordService res)
        {
            _res = res;
        }

        public async Task<Results<List<SheepRecord>>> Handle(ShowBreedStateCommand request, CancellationToken cancellationToken)
        {
            var list = await _res.SheepRecordList(request.recordType,request.breedState,request.presentState,request.growState);
            return Results<List<SheepRecord>>.DataResult(list);
        }
    }
}
